﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CandooMwrf
{
    public class Card
    {
        public string[] KeyA { get; set; }
        public string[] KeyB { get; set; }
        public string[] DesKey { get; set; }

        public Card()
        {
            KeyA = new string[16];
            KeyB = new string[16];
            DesKey = new string[16];
            KeyA[0] = "E9C63B944A6E";
            KeyA[1] = "5B8FD362AAF5";
            KeyA[2] = "991D1B8F6662";
            KeyA[3] = "333747D21C8D";
            KeyA[4] = "C634CCB63134";
            KeyA[5] = "5431D4FA4CC4";
            KeyA[6] = "49B5FB05CBB2";
            KeyA[7] = "D8C23583D706";
            KeyA[8] = "5FCCDD1A520B";
            KeyA[9] = "1F16A9ADCE16";
            KeyA[10] = "A1A55E9E0E79";
            KeyA[11] = "219FD15646B1";
            KeyA[12] = "662D6B95FA59";
            KeyA[13] = "57435CC55665";
            KeyA[14] = "573ADFC8DB35";
            KeyA[15] = "1A9BE7E56426";

            KeyB[0] = "5339B3BC6238";
            KeyB[1] = "3509862BB324";
            KeyB[2] = "9F891C50568A";
            KeyB[3] = "B9DB4FF947D4";
            KeyB[4] = "9958C39C3BAA";
            KeyB[5] = "CA81C94542C0";
            KeyB[6] = "A59BE024904D";
            KeyB[7] = "DE2B86BA2952";
            KeyB[8] = "18CA455C2B88";
            KeyB[9] = "D65AF2DF220A";
            KeyB[10] = "7598CDDB6032";
            KeyB[11] = "5B59475CAABA";
            KeyB[12] = "AA954A011A1B";
            KeyB[13] = "4DDF2E718471";
            KeyB[14] = "656E55406EE7";
            KeyB[15] = "CDC679D6AFF8";

            DesKey[0] = "B33F1606E8CD4A06";
            DesKey[1] = "AD898EE9ECF74318";
            DesKey[2] = "249400776FA9289F";
            DesKey[3] = "4F3A15E16B480DFF";
            DesKey[4] = "1A19D434C76E2E10";
            DesKey[5] = "7BE65E963B099936";
            DesKey[6] = "F6BAC08F8992340A";
            DesKey[7] = "1777B6ADB7699B65";
            DesKey[8] = "7C8ECFD2220F50B5";
            DesKey[9] = "66F0FC884B926445";
            DesKey[10] = "A0DFEAB1877D7687";
            DesKey[11] = "E5CA1C50B8805812";
            DesKey[12] = "4BF919AC3AC713E7";
            DesKey[13] = "690B299896ABBE85";
            DesKey[14] = "13700DD87EEADDFF";
            DesKey[15] = "1848ED58F200FDE5";
        }

        //卡号 卡guid 卡类别
        public string CardSN { get; set; }  //块0 16字节  //卡内默认,不用管

        //检验码 ,只检验卡号块字节流
        public short CrcCode { get; set; } //块1  2字节

        //制卡软件版本号
        public ushort DogVersion { get; set; } //块1  2字节

        //公钥,以后可能用到
        public int PublicKey { get; set; } //块1  4字节 

        //制卡日期 160101 01
        public DateTime BirthDate { get; set; } //块1  8字节

        #region 卡号信息

        public string CardNo { get; set; }//块2 分配32字节

        //卡面额
        public UInt32 CardMoney { get; set; }//块2  4字节

        /// <summary>
        /// 会员卡,油卡,售油机卡,等
        /// </summary>
        public ushort CardType { get; set; }//块2  2字节

        #endregion

        #region 制卡设备版本

        /// <summary>
        /// 制卡机 读写器 软件版本号
        /// </summary>
        public string Device_lib_ver { get; set; }

        /// <summary>
        /// 制卡机 读写器硬件版本号
        /// </summary>
        public string Device_ver { get; set; }

        #endregion

        #region 激活密码

        //激活密码(只在激活时使用,由系统随机产生或由制卡人指定)
        public string ActivePassword { get; set; }
        public string ActiveSalt { get; set; }

        //有效期
        public int ActiveDeadline { get; set; }

        #endregion

        #region 卡余额,同步时间,同步设备名称与id

        //卡余额
        public long Money { get; set; }

        #endregion

        #region 用户信息,用户guid,用户姓名,用户用户名

        public Guid UserId { get; set; }
        public string UserName { get; set; }
        public string Name { get; set; }

        #endregion

    }
}
